package io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

/**
 * @Author: wenjingyuan
 * @Date: 2023/05/29/17:57
 * @Description:
 */
public class InputStreamDemo2 {
    public static void main(String[] args) {
        //1.创建流对象 try catch resource
        try (InputStream inputStream=new FileInputStream("b.txt")){
            //2.读写操作
            while(true){
                int c=inputStream.read();
                if(c==-1) break;
                Thread.sleep(200);
                System.out.printf("%c",c);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }


    }
}
